package com.bree.erp.report.jasper;


import net.sf.jasperreports.engine.JRDataSource;
import net.sf.jasperreports.engine.JRDataSourceProvider;
import net.sf.jasperreports.engine.JRException;
import net.sf.jasperreports.engine.JRField;
import net.sf.jasperreports.engine.JasperReport;
import net.sf.jasperreports.engine.design.JRDesignField;

public class JRBreeDataSourceProvider implements JRDataSourceProvider {
	

	@Override
	public JRDataSource create(JasperReport arg0) throws JRException {
		
		return new JRPurchaseRequisitionDataSource(null);
	}

	@Override
	public void dispose(JRDataSource arg0) throws JRException {
		// TODO Auto-generated method stub
		
	}

	@Override
	public JRField[] getFields(JasperReport arg0) throws JRException,
			UnsupportedOperationException {
		
		JRDesignField field1 = new JRDesignField();
		field1.setName("purchaseRequisition");
		field1.setValueClassName("com.bree.erp.data.jasper.PurchaseRequisitionData");
		
		JRDesignField field2 = new JRDesignField();
		field2.setName("items");
		field2.setValueClassName("java.util.Collection");
		
		
		return new JRField[] {field1, field2};
	}

	@Override
	public boolean supportsGetFieldsOperation() {
		return false;
	}


}
